#include <iostream>
using namespace std;
typedef long long ll;
ll t, n, k;
int main(){
	cin >> t;
	while(t--){
		cin >> n >> k;
		if (k < n){
			cout << k << endl;
		}
		else{
			ll cnt  = k / (n - 1);
			if (k % (n - 1) == 0) cout << cnt * n - 1 << endl;
			else cout << cnt * n + k % (n - 1) << endl;
		}
	}

    return 0;
}


